#include "Vector2D.h"

Vector2D::Vector2D(float x, float y)
{
	this->x = x;
	this->y = y;
}

Vector2D::Vector2D(const Vector2D& v)
{
	//Initialize the internal members
	this->x = v.x;
	this->y = v.y;
}

Vector2D::~Vector2D()
{
}

float Vector2D::Length()
{
	return sqrt((x*x) + (y*y));
}

void Vector2D::Normalize()
{

}

void Vector2D::Reverse()
{
	x = -x;
	y = -y;
}

Vector2D Vector2D::operator+(const Vector2D& v)
{
	float x = this->x + v.x;
	float y = this->y + v.y;
	return Vector2D((this->x + v.x), (this->y + v.y));
}

Vector2D Vector2D::operator-(const Vector2D& v)
{
	return Vector2D((this->x - v.x), (this->y - v.y));
}

float Vector2D::operator*(const Vector2D& v)
{
	return (float) ((this->x * v.x) + (this->y * v.y));
}

Vector2D Vector2D::operator^(const Vector2D& v)
{
	return Vector2D((this->x * v.x), (this->y * v.y));
}

Vector2D Vector2D::operator+=(const Vector2D& v)
{
	this->x += v.x;
	this->y += v.y;
	return *this;
}

Vector2D Vector2D::operator-=(const Vector2D& v)
{
	this->x -= v.x;
	this->y -= v.y;
	return *this;
}

Vector2D Vector2D::operator*=(const float& s)
{
	this->x *= s;
	this->y *= s;
	return *this;
}

Vector2D Vector2D::operator^=(const Vector2D& v)
{
	this->x *= v.y;
	this->y += v.x;
	return *this;
}

Vector2D Vector2D::operator/=(const Vector2D& v)
{
	this->x /= v.x;
	this->y /= v.y;
	return *this;
}